# This is a BitKeeper generated patch for the following project: # Project Name: Linux kernel tree # This patch format is intended for GNU patch command version 2.5 or higher. # This patch includes the following deltas: # ChangeSet 1.1046.15.54 -> 1.1046.15.55 # include/asm-ppc/pgtable.h 1.21 -> 1.21.1.1 # drivers/char/mem.c 1.35.1.3 -> 1.35.1.4 # include/asm-x86_64/pgtable.h 1.18 -> 1.18.1.1 # include/asm-i386/pgtable.h 1.35 -> 1.36 # include/asm-m68k/pgtable.h 1.6 -> 1.6.1.1 # include/asm-ppc64/pgtable.h 1.21 -> 1.21.1.1 # # The following is the BitKeeper ChangeSet Log # -------------------------------------------- # 03/06/04 rmk@flint.arm.linux.org.uk 1.1046.215.3 # [ARM] Convert platform devices to use platform_device # # Since struct platform_device now has the ability to pass resources, # defined by the platform to the device driver, we can now use this # to handle platform specific devices. One such instance is the # StrongARM SA1111 companion chip, which can appear in various address # spaces, and connected to different IRQ lines depending on how many # cups of coffee the hardware designer had, the direction of the wind # outside the designers office that day. # # We also convert some of the other StrongARM peripheral on-chip # devices to use struct platform_device. # # ARM also provides a platform_add_devices() function which can be # used by platform code to bulk-register a tabular set of platform # devices. # -------------------------------------------- # 03/06/04 rmk@flint.arm.linux.org.uk 1.1046.215.4 # [ARM] Tidy up Integrator core support. # # This merges arch.c, irq.c and mm.c into one core file for this # platform; it's pointless keeping these separate. # -------------------------------------------- # 03/06/04 agrover@groveronline.com 1.1046.219.1 # Merge groveronline.com:/root/bk/linux-2.5 # into groveronline.com:/root/bk/linux-acpi # -------------------------------------------- # 03/06/05 paulus@samba.org 1.1046.138.37 # Merge samba.org:/stuff/paulus/kernel/linux-2.5 # into samba.org:/stuff/paulus/kernel/for-linus-ppc # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.1 # Merge gregkh@kernel.bkbits.net:/home/gregkh/linux/pci-good-2.5 # into kroah.com:/home/greg/linux/BK/p-2.5 # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.2 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/alpha/kernel/sys_sio.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.3 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/arm/kernel/bios32.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.4 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ia64/hp/common/sba_iommu.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.5 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ia64/sn/io/pci_bus_cvlink.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.6 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ia64/sn/io/pciba.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.7 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ia64/sn/io/sn2/pci_bus_cvlink.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.8 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/mips/ddb5074/pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.9 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/mips/ddb5476/pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.10 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/mips/ddb5xxx/ddb5477/pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.11 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/mips/mips-boards/generic/pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.12 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/mips/sni/pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.13 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/mips64/mips-boards/generic/pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.14 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/mips64/sgi-ip32/ip32-pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.15 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc/kernel/pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.16 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc/platforms/chrp_pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.17 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc/platforms/gemini_pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.18 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc/platforms/pmac_pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.19 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc/platforms/prep_pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.20 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc64/kernel/iSeries_pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.21 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc64/kernel/pSeries_pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.22 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/ppc64/kernel/pci_dma.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.23 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/sh/kernel/pci-sh7751.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.24 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/v850/kernel/rte_mb_a_pci.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.25 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/x86_64/kernel/bluesmoke.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.26 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/x86_64/kernel/pci-gart.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.27 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/x86_64/pci/irq.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.28 # [PATCH] PCI: remove usage of pci_for_each_dev() in arch/x86_64/pci/x86-64.c # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.29 # [PATCH] PCI: finally remove pci_for_each_dev() now that all users of it are gone. # -------------------------------------------- # 03/06/04 greg@kroah.com 1.1046.220.30 # PCI: remove usage of pci_for_each_dev() in arch/ppc64/kernel/pci.c # -------------------------------------------- # 03/06/04 acme@conectiva.com.br 1.1046.221.1 # o net: create struct sock_common and use in struct sock & tcp_tw_bucket # # With this the data dependency is reduced to just making sure that the first # member of both struct sock and struct tcp_tw_bucket are a struct sock_common. # # Also makes it easier to grep for struct sock and struct tcp_tw_bucket usage in # the tree as all the members in those structs are prefixed, respectively, with # sk_ and tw_, like struct inode (i_), struct block_device (bd_), etc. # # Checked namespace with make tags/ctags, just one colision with the macros for # the struct sock members, with a wanrouter struct, fixed that # s/sk_state/state_sk/g in the wanrouter struct. # # Checked as well if the names of the members in both structs collided with some # macro, none found. # -------------------------------------------- # 03/06/04 Jeff.Wiedemeier@hp.com 1.1046.222.1 # [PATCH] compile fix for agp_memory struct definitition change # # In 2.5.70, the agp_memory struct changed from: # typedef struct agp_memory # to: # struct agp_memory # # This patch propagates that change into include/asm-alpha/agp_backend.h and # arch/alpha/kernel/core_{titan,marvel}.c # # /jeff # -------------------------------------------- # 03/06/04 davidm@tiger.hpl.hp.com 1.1046.15.55 # Clean up drivers/char/mem.c to reduce #ifdef bloat. Make it work better on ia64. # -------------------------------------------- # diff -Nru a/drivers/char/mem.c b/drivers/char/mem.c --- a/drivers/char/mem.c Mon Sep 22 13:00:14 2003 +++ b/drivers/char/mem.c Mon Sep 22 13:00:14 2003 @@ -29,13 +29,56 @@ #include #include +#ifdef CONFIG_IA64 +# include +#endif + #ifdef CONFIG_FB extern void fbmem_init(void); #endif #if defined(CONFIG_S390_TAPE) && defined(CONFIG_S390_TAPE_CHAR) extern void tapechar_init(void); #endif - + +/* + * Architectures vary in how they handle caching for addresses + * outside of main memory. + * + */ +static inline int uncached_access(struct file *file, unsigned long addr) +{ +#if defined(__i386__) + /* + * On the PPro and successors, the MTRRs are used to set + * memory types for physical addresses outside main memory, + * so blindly setting PCD or PWT on those pages is wrong. + * For Pentiums and earlier, the surround logic should disable + * caching for the high addresses through the KEN pin, but + * we maintain the tradition of paranoia in this code. + */ + if (file->f_flags & O_SYNC) + return 1; + return !( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) || + test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) || + test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || + test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) ) + && addr >= __pa(high_memory); +#elif defined(CONFIG_IA64) + /* + * On ia64, we ignore O_SYNC because we cannot tolerate memory attribute aliases. + */ + return !(efi_mem_attributes(addr) & EFI_MEMORY_WB); +#else + /* + * Accessing memory above the top the kernel knows about or through a file pointer + * that was marked O_SYNC will be done non-cached. + */ + if (file->f_flags & O_SYNC) + return 1; + return addr >= __pa(high_memory); +#endif +} + static ssize_t do_write_mem(struct file * file, void *p, unsigned long realp, const char * buf, size_t count, loff_t *ppos) { @@ -71,6 +114,7 @@ { unsigned long p = *ppos; unsigned long end_mem; + int uncached; ssize_t read; void *addr; @@ -96,13 +140,14 @@ } } #endif - if (file->f_flags & O_SYNC) + uncached = uncached_access(file, (unsigned long) p); + if (uncached) addr = ioremap(p, count); else addr = __va(p); if (copy_to_user(buf, addr, count)) return -EFAULT; - if (file->f_flags & O_SYNC) + if (uncached) iounmap(addr); read += count; *ppos += read; @@ -114,6 +159,7 @@ { unsigned long p = *ppos; unsigned long end_mem; + int uncached; ssize_t ret; void *addr; @@ -122,87 +168,25 @@ return 0; if (count > end_mem - p) count = end_mem - p; - if (file->f_flags & O_SYNC) + uncached = uncached_access(file, (unsigned long) p); + if (uncached) addr = ioremap(p, count); else addr = __va(p); ret = do_write_mem(file, addr, p, buf, count, ppos); - if (file->f_flags & O_SYNC) + if (uncached) iounmap(addr); return ret; } -#ifndef pgprot_noncached - -/* - * This should probably be per-architecture in - */ -static inline pgprot_t pgprot_noncached(pgprot_t _prot) -{ - unsigned long prot = pgprot_val(_prot); - -#if defined(__i386__) || defined(__x86_64__) - /* On PPro and successors, PCD alone doesn't always mean - uncached because of interactions with the MTRRs. PCD | PWT - means definitely uncached. */ - if (boot_cpu_data.x86 > 3) - prot |= _PAGE_PCD | _PAGE_PWT; -#elif defined(__powerpc__) - prot |= _PAGE_NO_CACHE | _PAGE_GUARDED; -#elif defined(__mc68000__) && defined(CONFIG_MMU) -#ifdef SUN3_PAGE_NOCACHE - if (MMU_IS_SUN3) - prot |= SUN3_PAGE_NOCACHE; - else -#endif - if (MMU_IS_851 || MMU_IS_030) - prot |= _PAGE_NOCACHE030; - /* Use no-cache mode, serialized */ - else if (MMU_IS_040 || MMU_IS_060) - prot = (prot & _CACHEMASK040) | _PAGE_NOCACHE_S; -#endif - - return __pgprot(prot); -} - -#endif /* !pgprot_noncached */ - -/* - * Architectures vary in how they handle caching for addresses - * outside of main memory. - */ -static inline int noncached_address(unsigned long addr) -{ -#if defined(__i386__) - /* - * On the PPro and successors, the MTRRs are used to set - * memory types for physical addresses outside main memory, - * so blindly setting PCD or PWT on those pages is wrong. - * For Pentiums and earlier, the surround logic should disable - * caching for the high addresses through the KEN pin, but - * we maintain the tradition of paranoia in this code. - */ - return !( test_bit(X86_FEATURE_MTRR, boot_cpu_data.x86_capability) || - test_bit(X86_FEATURE_K6_MTRR, boot_cpu_data.x86_capability) || - test_bit(X86_FEATURE_CYRIX_ARR, boot_cpu_data.x86_capability) || - test_bit(X86_FEATURE_CENTAUR_MCR, boot_cpu_data.x86_capability) ) - && addr >= __pa(high_memory); -#else - return addr >= __pa(high_memory); -#endif -} - static int mmap_mem(struct file * file, struct vm_area_struct * vma) { unsigned long offset = vma->vm_pgoff << PAGE_SHIFT; - /* - * Accessing memory above the top the kernel knows about or - * through a file pointer that was marked O_SYNC will be - * done non-cached. - */ - if (noncached_address(offset) || (file->f_flags & O_SYNC)) +#ifdef pgprot_noncached + if (uncached_access(file, offset)) vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); +#endif /* Don't try to swap out physical pages.. */ vma->vm_flags |= VM_RESERVED; diff -Nru a/include/asm-i386/pgtable.h b/include/asm-i386/pgtable.h --- a/include/asm-i386/pgtable.h Mon Sep 22 13:00:14 2003 +++ b/include/asm-i386/pgtable.h Mon Sep 22 13:00:14 2003 @@ -221,6 +221,13 @@ static inline void ptep_mkdirty(pte_t *ptep) { set_bit(_PAGE_BIT_DIRTY, &ptep->pte_low); } /* + * Macro to mark a page protection value as "uncacheable". On processors which do not support + * it, this is a no-op. + */ +#define pgprot_noncached(prot) ((boot_cpu_data.x86 > 3) \ + ? (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) : (prot)) + +/* * Conversion functions: convert a page and protection to a page entry, * and a page entry and page directory to the page they refer to. */ diff -Nru a/include/asm-m68k/pgtable.h b/include/asm-m68k/pgtable.h --- a/include/asm-m68k/pgtable.h Mon Sep 22 13:00:14 2003 +++ b/include/asm-m68k/pgtable.h Mon Sep 22 13:00:14 2003 @@ -172,6 +172,23 @@ #ifndef __ASSEMBLY__ #include +/* + * Macro to mark a page protection value as "uncacheable". + */ +#ifdef SUN3_PAGE_NOCACHE +# define __SUN3_PAGE_NOCACHE SUN3_PAGE_NOCACHE +#else +# define __SUN3_PAGE_NOCACHE 0 +#endif +#define pgprot_noncached(prot) \ + (MMU_IS_SUN3 \ + ? (__pgprot(pgprot_val(prot) | __SUN3_PAGE_NOCACHE)) \ + : ((MMU_IS_851 || MMU_IS_030) \ + ? (__pgprot(pgprot_val(prot) | _PAGE_NOCACHE030)) \ + : (MMU_IS_040 || MMU_IS_060) \ + ? (__pgprot((pgprot_val(prot) & _CACHEMASK040) | _PAGE_NOCACHE_S)) \ + : (prot))) + typedef pte_t *pte_addr_t; #endif /* !__ASSEMBLY__ */ diff -Nru a/include/asm-ppc/pgtable.h b/include/asm-ppc/pgtable.h --- a/include/asm-ppc/pgtable.h Mon Sep 22 13:00:14 2003 +++ b/include/asm-ppc/pgtable.h Mon Sep 22 13:00:14 2003 @@ -477,6 +477,11 @@ pte_update(ptep, 0, _PAGE_DIRTY); } +/* + * Macro to mark a page protection value as "uncacheable". + */ +#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED)) + #define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HASHPTE) == 0) #define pmd_page_kernel(pmd) \ diff -Nru a/include/asm-ppc64/pgtable.h b/include/asm-ppc64/pgtable.h --- a/include/asm-ppc64/pgtable.h Mon Sep 22 13:00:14 2003 +++ b/include/asm-ppc64/pgtable.h Mon Sep 22 13:00:14 2003 @@ -303,6 +303,11 @@ pte_update(ptep, 0, _PAGE_DIRTY); } +/* + * Macro to mark a page protection value as "uncacheable". + */ +#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_NO_CACHE | _PAGE_GUARDED)) + #define pte_same(A,B) (((pte_val(A) ^ pte_val(B)) & ~_PAGE_HPTEFLAGS) == 0) /* diff -Nru a/include/asm-x86_64/pgtable.h b/include/asm-x86_64/pgtable.h --- a/include/asm-x86_64/pgtable.h Mon Sep 22 13:00:14 2003 +++ b/include/asm-x86_64/pgtable.h Mon Sep 22 13:00:14 2003 @@ -263,6 +263,11 @@ static inline void ptep_set_wrprotect(pte_t *ptep) { clear_bit(_PAGE_BIT_RW, ptep); } static inline void ptep_mkdirty(pte_t *ptep) { set_bit(_PAGE_BIT_DIRTY, ptep); } +/* + * Macro to mark a page protection value as "uncacheable". + */ +#define pgprot_noncached(prot) (__pgprot(pgprot_val(prot) | _PAGE_PCD | _PAGE_PWT)) + #define __LARGE_PTE (_PAGE_PSE|_PAGE_PRESENT) static inline int pmd_large(pmd_t pte) { return (pmd_val(pte) & __LARGE_PTE) == __LARGE_PTE;